<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
	<script src="{yun:}$config.sy_weburl{/yun}/js/jquery-1.8.0.min.js?v={yun:}$config.cachecode{/yun}"></script>
	<script src="js/admin_public.js?v={yun:}$config.cachecode{/yun}"></script>
	<link href="{yun:}$config.sy_weburl{/yun}/js/layui/css/layui.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet">
	<script src="{yun:}$config.sy_weburl{/yun}/js/layui/layui.js?v={yun:}$config.cachecode{/yun}" language="javascript"></script>
	<script src="{yun:}$config.sy_weburl{/yun}/js/layui/phpyun_layer.js?v={yun:}$config.cachecode{/yun}"></script>
	<link href="images/reset.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet" type="text/css" />
	<link href="images/system.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet" type="text/css" />
	<link href="images/table_form.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet" type="text/css" />
	
	<style>
		* { margin: 0; padding: 0; }
		body, div { margin: 0; padding: 0; }
		.layui-form-item{ margin-bottom:0px;}
	</style>
	
	<title>后台管理</title>
</head>

<body class="body_ifm">
	<div class="infoboxp">
	
		<div class="admin_new_tip">
			<a href="javascript:;" class="admin_new_tip_close"></a>
			<a href="javascript:;" class="admin_new_tip_open" style="display:none;"></a>
			<div class="admin_new_tit"><i class="admin_new_tit_icon"></i>操作提示</div>
				<div class="admin_new_tip_list_cont">
				<div class="admin_new_tip_list">该页面可对兼职职位进行编辑修改操作。</div>
			</div>
		</div>

  		<div class="tag_box mt10">
    		<iframe id="supportiframe"  name="supportiframe" onload="returnmessage('supportiframe');" style="display:none"></iframe>
    		<form class="layui-form" action="" target="supportiframe" method="post" onsubmit="return CheckPost_part();">
		      	<table width="100%" class="table_form" style="background:#fff;">
			       	<tr>
			        	<td colspan="4" bgcolor="#f0f6fb"><div class="admin_bold">兼职职位详情</div></td>
			      	</tr>
		        	
		        	<input type="hidden" name="pytoken" value="{yun:}$pytoken{/yun}"/>
		        	
			        {yun:}if $show.id{/yun}
				        <tr >
				          	<th>招聘编号：</th>
				          	<td><div class="yun_admin_divh">{yun:}$show.id{/yun}</div></td>
				        </tr>
			        {yun:}/if{/yun}
			        
			        <tr class="admin_table_trbg" >
			          	<th>招聘名称：</th>
			          	<td><input type="text" name="name" id="name" class="input-text" size="30" value="{yun:}$show.name{/yun}"></td>
			        </tr>
			        
			        <tr>
			          	<th>工作类型：</th>
			          	<td>
							<div class="layui-form-item">
						 		<div class="layui-input-block">
									<div class="layui-input-inline">
										<select name="type" lay-filter="type" id="type">
											<option>请选择</option>
										 	{yun:}foreach from=$partdata.part_type item=v key=j{/yun}
												<option  value="{yun:}$v{/yun}" {yun:}if $show.type==$v{/yun}selected{yun:}/if{/yun}> {yun:}$partclass_name[$v]{/yun} </option>
											{yun:}/foreach{/yun}
										</select>
								  	</div>
								</div>
						  	</div>
						</td>
			        </tr>
			        
				 	<tr class="admin_table_trbg" >
		          		<th width="120">招聘人数：</th>
		          		<td><input type="text" name="number" id="number" class="input-text" size="10" value="{yun:}$show.number{/yun}"></td>
		        	</tr>
		        	<tr>
		          		<th width="120">兼职时间：</th>
		          		<td>
						  	<table class="tjob_timetable" style="float:left" >
						  		<tbody>
									<tr>
										<th>&nbsp;</th>
										<th>周一</th>
										<th>周二</th>
										<th>周三</th>
										<th>周四</th>
										<th>周五</th>
										<th>周六</th>
										<th>周日</th>
									</tr>
									<tr>
										<th>上午</th>
										{yun:}foreach from=$part_morning item=v{/yun}
											<td><input data-mark='isneed' name='worktime[]' class="check_all" type="checkbox" {yun:}if in_array($v,$show.worktime_n){/yun}checked="checked"{yun:}/if{/yun}value='{yun:}$v{/yun}' lay-filter="partAll" lay-skin="primary" /></td>
										{yun:}/foreach{/yun}
									</tr>
									<tr>
										<th>下午</th>
										{yun:}foreach from=$part_noon item=v{/yun}
										<td><input data-mark='isneed' name='worktime[]' class="check_all" type="checkbox" {yun:}if in_array($v,$show.worktime_n){/yun}checked="checked"{yun:}/if{/yun} value='{yun:}$v{/yun}' lay-filter="partAll" lay-skin="primary" /></td>
										{yun:}/foreach{/yun}
									</tr>
									<tr>
										<th>晚上</th>
										{yun:}foreach from=$part_afternoon item=v{/yun}
										<td><input data-mark='isneed' name='worktime[]' class="check_all" type="checkbox" {yun:}if in_array($v,$show.worktime_n){/yun}checked="checked"{yun:}/if{/yun} value='{yun:}$v{/yun}' lay-filter="partAll" lay-skin="primary" /></td>
										{yun:}/foreach{/yun}
									</tr>
								 	<tr><td colspan="8">	<input id='ckAll' type="checkbox" class="com_Release_job_qx_check"  {yun:}if in_array($v,$show.worktime_n) && $show.workcishu==21{/yun}checked="checked"{yun:}/if{/yun} lay-filter="ckAll" title="全选" lay-skin="primary"></td></tr>
								</tbody>
							</table>
						</td>
		        	</tr>
					<tr class="admin_table_trbg">
						<th width="120">兼职有效期：</th>
						<td>
							<input id="sdate" class="part_text_time item_date" type="text" readonly size="15" value="{yun:}$show.sdate|date_format:'%Y-%m-%d'{/yun}" name="sdate">
							<input id="edate" class="part_text_time item_date" type="text" readonly size="15" value="{yun:}$show.edate|date_format:'%Y-%m-%d'{/yun}" name="edate" {yun:}if $show.edate==0{/yun}style="display:none"{yun:}/if{/yun}/>
							<input type="checkbox" value='1' id="timetype" name="timetype" lay-skin="primary"{yun:}if $show.edate==0{/yun}checked="checked"{yun:}/if{/yun} lay-filter="timetype" title="长期招聘"/>
			 			</td>
			        </tr>
					
			        <tr class="admin_table_trbg" >
						<th width="120">薪　　水：</th>
						<td>
			          		<div class="layui-form-item">
				 				<div class="layui-input-block">
									<div class="layui-input-inline">
										<input type="text" name="salary" id="salary" class="input-text" size="10" value="{yun:}$show.salary{/yun}" style="float:left;width:100px; margin-right:10px;">
									</div>
									<div class="layui-input-inline">
										<select name="salary_type" lay-filter="" id="salary_type">
											<option>请选择</option>
											{yun:}foreach from=$partdata.part_salary_type item=v key=j{/yun}
												<option  value="{yun:}$v{/yun}" {yun:}if $show.salary_type==$v{/yun}selected{yun:}/if{/yun}>{yun:}$partclass_name[$v]{/yun}</option>
											{yun:}/foreach{/yun}
										</select>
									</div>
								</div>
			 				</div>
						</td>
			   		</tr>
		       	 	<tr>
		          		<th width="120">薪资结算：</th>
		          		<td>
							<div class="layui-form-item">
								<div class="layui-input-block">
									<div class="layui-input-inline">
										<select name="billing_cycle" lay-filter="" id="billing_cycle">
											<option>请选择</option>
										 	{yun:}foreach from=$partdata.part_billing_cycle item=v key=j{/yun}
												<option  value="{yun:}$v{/yun}" {yun:}if $show.billing_cycle==$v{/yun}selected{yun:}/if{/yun} > {yun:}$partclass_name[$v]{/yun} </option>
											{yun:}/foreach{/yun}
										</select>
									</div>
								</div>
							</div>
						</td>
		        	</tr>
					<tr class="具体要求" >
		          		<th width="120">工作内容：</th>
		          		<td>
		 					<script id="content" name="content" type="text/plain" style="width:600px; height:200px;"> {yun:}$show.content{/yun} </script>
				  		</td>
		        	</tr>
					<tr>
		          		<th width="120">性　　别：</th>
		          		<td>
				    		<div class="layui-form-item">
					 			<div class="layui-input-block">
									<div class="layui-input-inline">
										<select name="sex" lay-filter="" id="sex">
											<option>请选择</option>
							 				{yun:}foreach from=$part_sex item=v key=j{/yun}
												<option  value="{yun:}$j{/yun}" {yun:}if $show.sex==$j{/yun}selected{yun:}/if{/yun} > {yun:}$v{/yun} </option> 
											{yun:}/foreach{/yun}
										</select>
							  		</div>
								</div>
					  		</div>
		          		</td>
		        	</tr>
		        	
		        	<tr class="admin_table_trbg">
		          		<th>工作地点：</th>
		          		<td>
				  		   	<div class="layui-form-item">
				  		   	
					          	<div class="layui-input-inline">
					            	<select name="provinceid" id="provinceid" lay-filter="citys">
						              	<option value="">请选择</option>
						              	{yun:}foreach from=$city_index key=j item=v{/yun}
						              		<option value="{yun:}$v{/yun}" {yun:}if $show.provinceid == $v{/yun} selected{yun:}/if{/yun} >{yun:}$city_name[$v]{/yun} </option>
						              	{yun:}/foreach{/yun}
						         	</select>
					          	</div>
					          	
					          	<div class="layui-input-inline">
					            	<select name="cityid" lay-filter="citys" id="cityid">
					              		<option value="">请选择</option>
					              		{yun:}foreach from=$city_type[$show.provinceid] key=j item=v{/yun}
					              			<option value="{yun:}$v{/yun}" {yun:}if $show.cityid==$v{/yun} selected{yun:}/if{/yun} >{yun:}$city_name[$v]{/yun}</option>
					              		{yun:}/foreach{/yun}
					            	</select>
					          	</div>
					          	
					          	<div class="layui-input-inline">
					            	<select name="three_cityid" lay-filter="three_cityid" id="three_cityid">
					              		<option value="">请选择</option>
					              		{yun:}foreach from=$city_type[$show.cityid] key=j item=v{/yun}
					              			<option value="{yun:}$v{/yun}" {yun:}if $show.three_cityid==$v{/yun} selected{yun:}/if{/yun}>{yun:}$city_name[$v]{/yun}</option>
					              		{yun:}/foreach{/yun}
					           		</select>
					          	</div>
		        			</div> 
		            	</td>
		        	</tr>
		        	<tr>
		          		<th width="120">详细地址：</th>
		          		<td><input type="text" class="input-text" name="address" id="address" size="30" value="{yun:}$show.address{/yun}"></td>
		        	</tr>
			        <tr>
			          	<th width="120"></th>
			          	<td >
			            	<div id="map_container" style="width:70%;height:300px;"></div>
			            	<input name="x" id="map_x" type="hidden" value="{yun:}$show.x{/yun}">
			            	<input name="y" id="map_y" type="hidden" value="{yun:}$show.y{/yun}">
			            </td>
			        </tr>
			        <tr>
			          	<th width="120">联系人：</th>
			          	<td><input type="text" class="input-text" name="linkman" id="linkman" size="15" value="{yun:}$show.linkman{/yun}"></td>
			        </tr>
		        	<tr class="admin_table_trbg">
		          		<th width="120">联系手机：</th>
		          		<td><input type="text" class="input-text" name="linktel" id="linktel" size="15" value="{yun:}$show.linktel{/yun}"></td>
		        	</tr>
		        	
			        {yun:}if $show.id{/yun}
			        	<tr>
			          	<th width="120">状　　态：</th>
			            	<td>
			            		<div class="yun_admin_divh">
			            			{yun:}if ($show.edate lt time() && $show.edate>'0')||$show.state==2{/yun}<font color="orange">已过期</font>
						            {yun:}elseif $show.state==1{/yun}<font color="blue">已审核</font>
						            {yun:}elseif $show.state==3{/yun}<font color="red">未通过</font>
						            {yun:}elseif $show.state==0{/yun}<font color="red">未审核</font>
						            {yun:}/if{/yun}
						       	</div>
			            	</td>
			        	</tr>
			        {yun:}/if{/yun}
			        
			        <tr>
			          	<th width="120"></th>
			          	<td> 
                  <input type="hidden" id="r_status" name="r_status" value="{yun:}$company.r_status{/yun}">
                  <input type="hidden" id="cionly" name="cionly" value="{yun:}if empty($city_type){/yun}1{yun:}/if{/yun}">
				  		   	
			          		{yun:}if $show.id{/yun}
			            		<input type="hidden" name="lasturl" value="{yun:}$lasturl{/yun}">
			            		<input type="hidden" name="id" value="{yun:}$show.id{/yun}">
			            		<input class="layui-btn layui-btn-normal" type="submit" name="update" value="&nbsp;修 改&nbsp;" />
			            	{yun:}else{/yun}
			            		<input class="layui-btn layui-btn-normal" type="submit" name="update" value="&nbsp;保 存&nbsp;" />
			            	{yun:}/if{/yun} 
			            </td>
			        </tr>
		      	</table>
		  	</form>
  		</div>
	</div>
	
	<script src="{yun:}$config.mapurl{/yun}"></script> 
	<script type="text/javascript" src="{yun:}$config.sy_weburl{/yun}/js/map.js?v={yun:}$config.cachecode{/yun}"></script>
	<script language=javascript src='{yun:}$config.sy_weburl{/yun}/data/plus/city.cache.js?v={yun:}$config.cachecode{/yun}'></script>
	<script language=javascript src='{yun:}$config.sy_weburl{/yun}/js/city.js?v={yun:}$config.cachecode{/yun}'></script>
	<script src="{yun:}$config.sy_weburl{/yun}/js/ueditor/ueditor.config.js?v={yun:}$config.cachecode{/yun}"></script>
	<script src="{yun:}$config.sy_weburl{/yun}/js/ueditor/ueditor.all.min.js?v={yun:}$config.cachecode{/yun}"></script>
	<script>
		var map=new BMap.Map("map_container");
		setLocation('map_container',116.404,39.915,"map_x","map_y");
		$(document).ready(function() {
			{yun:}if ($show.x=="" || $show.y=="") && $show.address!=""{/yun}
				$("#address").val("{yun:}$show.address{/yun}");
				localsearch('{yun:}if $city_name[$show.cityid]{/yun}{yun:}$city_name[$show.cityid]{/yun}{yun:}else{/yun}全国{yun:}/if{/yun}');
			{yun:}elseif $show.x!="" && $show.y!=""{/yun}
				setLocation('map_container',{yun:}$show.x{/yun},{yun:}$show.y{/yun},"map_x","map_y");
			{yun:}else{/yun}
				//根据IP到城市开始
				function myFun(result){
					var cityName = result.name;
					map.setCenter(cityName);
				}
				var myCity = new BMap.LocalCity();
				myCity.get(myFun);
				//根据IP到城市结结束
			{yun:}/if{/yun}
		});
		var local ;
		function getLocalResult(){
			var address=$.trim($("#address").val());
			var points=local.getResults();
				var lngLat=points.getPoi(0).point;
				setLocation('map_container',lngLat.lng,lngLat.lat,"map_x","map_y");
		}
		function localsearch(city){
			if($("#address").val()==""){
				layer.msg('请输入地址！', 2, 8);return false;
			}
			local = new BMap.LocalSearch(city, {
			renderOptions: {
				map: map,
				panel : "r-result",
				autoViewport: true,
				selectFirstResult: false
			  },onSearchComplete : getLocalResult
			});
			map.centerAndZoom(new BMap.Point(116.404, 39.915), 4);
			local.search($("#address").val());
		}
		function setLocation(id,x,y,xid,yid){
			var data=get_map_config();
			var config=eval('('+data+')');
			var rating,map_control_type,map_control_anchor;
			if(!x && !y){x=config.map_x;y=config.map_y;}
			var point = new BMap.Point(x,y);
			var marker = new BMap.Marker(point);
			var opts = {type:BMAP_NAVIGATION_CONTROL_LARGE}
			map.enableScrollWheelZoom(true);
			map.addControl(new BMap.NavigationControl(opts));
			map.centerAndZoom(point, 15);
			map.addOverlay(marker);
			map.addEventListener("click",function(e){
			   var info = new BMap.InfoWindow('', {width: 260});
				var projection = this.getMapType().getProjection();
				var lngLat = e.point;
				document.getElementById(xid).value=lngLat.lng;
				document.getElementById(yid).value=lngLat.lat;
				map.clearOverlays();
				var point = new BMap.Point(lngLat.lng,lngLat.lat);
				var marker = new BMap.Marker(point);
				map.addOverlay(marker);
			});
		}
	</script>
	
	<script type="text/javascript">
		var weburl="{yun:}$config.sy_weburl{/yun}";
		
		layui.use(['layer', 'form','laydate'], function(){
			var form = layui.form,
				laydate = layui.laydate,
				$ = layui.$,
				url = weburl+"/index.php?m=ajax&c=get_city_option";
		
			 //全选  
			form.on('checkbox(ckAll)', function(data){  
				var child = $(data.elem).parents('table').find('tbody input[name="worktime[]"]');  
				child.each(function(index, item){  
					item.checked = data.elem.checked;  
				});  
				form.render('checkbox');  
			}); 
			form.on('checkbox(partAll)',function(data){
         var item = $(".check_all");
         for (var i = 0; i < item.length; i++) {
        if (item[i].checked == false) {
          $("#ckAll").prop("checked", false);
            form.render('checkbox');
            break;
          }
        } 
        var all=item.length;//选择本页面   全选自动选中
        for (var i = 0; i < item.length; i++) {
          if (item[i].checked == true) {
            all--;
          }
        }
        if(all==0){
          $("#ckAll").prop("checked", true);
          form.render('checkbox');  
        } 
      })	
			form.on('checkbox(timetype)', function(data){
				if(data.elem.checked){
					$("#edate").hide();
					$("#dline").hide();
				}else{
					$("#dline").show();
					$("#edate").show();
				}
			});
		
			lay('.item_date').each(function(){
				laydate.render({
					elem: this,
					trigger: 'click'
				});
			});
		});//end layui.use()
		 
   		$(function(){
		    $('#upAllSelect').click(function(){
				ischecked = $(this).attr('checked');
				allcheck = $('input[data-mark="isneed"]');
				if(ischecked == 'checked'){
					allcheck.each(function(i){
						$(this).attr('checked',true);
					});
				}else{
					allcheck.each(function(i){
						$(this).attr('checked',false);
					});
				}		
			});
		});
		
		function change(){
			if($("#timetype").attr("checked")=='checked'){
				$("#edate").hide();
				$("#dline").hide();
			}else{
			    $("#dline").show();
				$("#edate").show();
			}
		}
	 
		UE.getEditor('content',{
			toolbars:[['Source','|','Bold', 'italic', 'underline', 'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright','insertorderedlist', 'insertunorderedlist','emotion']],
			wordCount:false,
		    elementPathEnabled:false,
		    initialFrameHeight:200
		});
		
		function CheckPost_part(){
			if($.trim($("#name").val())==""||$("#name").val()==$("#name").attr('placeholder')){
				layer.msg("请输入兼职名称！",2,8);return false;
			}
			if($.trim($("#type").val())==""||$.trim($("#type").val())=="请选择"){
				layer.msg("请选择兼职类型！",2,8);return false;
			}
			if($.trim($("#number").val())<1 ||$("#number").val()==$("#number").attr('placeholder')){
				layer.msg("请输入招聘人数！",2,8);return false;
			}
			var chk_value =[];
			$('input[name="worktime[]"]:checked').each(function(){
				chk_value.push($(this).val());
			});
			if(chk_value.length==0){
				layer.msg("请选择兼职时间！",2,8);return false;
			}
			var sdate=$("#sdate").val();
			var edate=$("#edate").val();
			var today=$("#today").val();
			var timetype=$("input[name='timetype']:checked").val();
			if(timetype){
				if(sdate==""||sdate==$("#sdate").attr('placeholder')){
					layer.msg("请选择开始日期！",2,8);return false;
				}
			}else{
				if(sdate=="" ||sdate==$("#sdate").attr('placeholder')){
					layer.msg("请选择开始日期！",2,8);return false;
				} 
				if(edate==""||edate==$("#edate").attr('placeholder')){
					layer.msg("请选择结束日期！",2,8);return false;
				} 
				if(toDate(edate).getTime()<toDate(sdate).getTime() || toDate(edate).getTime()<toDate(today).getTime()){
					layer.msg("请正确选择工作日期！",2,8);return false;
				}
			}	
			
			if($.trim($("#salary").val())==""||$.trim($("#salary").val())<1 ||$("#salary").val()==$("#salary").attr('placeholder')){
				layer.msg("请输入薪资水平！",2,8);return false;
			}
			if($.trim($("#salary_type").val())==""){
				layer.msg("请选择薪水类型！",2,8);return false;
			}
			
			if($.trim($("#billing_cycle").val())=="" ){
				layer.msg("请选择结算周期！",2,8);return false;
			}
			var content = editor.text();
			if($.trim(content)==""){
				layer.msg("请输入兼职内容！",2,8);return false;
			}
			var cionly	=	$.trim($("#cionly").val());
			if(cionly=='1'){
				if($("#provinceid").val()==""){
					layer.msg('请选择所在地区！',2,8);return false;
				}
			}else{
				if($.trim($("#cityid").val())==""){
					layer.msg("请选择工作地点！",2,8);return false;
				}
			}	
			if($.trim($("#address").val())==""||$("#address").val()==$("#address").attr('placeholder')){
				layer.msg("请输入详细地址！",2,8);return false;
			}
			if($.trim($("#map_x").val())==""||$.trim($("#map_y").val())==""){
				layer.msg("请选择地图！",2,8);return false;
			}		
			if($.trim($("#linkman").val())==""||$("#linkman").val()==$("#linkman").attr('placeholder')){
				layer.msg("请输入联系人！",2,8);return false;
			}
			if($.trim($("#linktel").val())==""||$("#linktel").val()==$("#linktel").attr('placeholder')){
				layer.msg("请输入联系手机！",2,8);return false;
			}
			var iftelphone = isjsMobile($.trim($("#linktel").val()));
			if(iftelphone==false){layer.msg('请正确填写联系手机！',2,8);return false;}
		}
	</script>
</body>
</html>